
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta
      http-equiv="Cache-Control"
      content="no-cache, no-store, must-revalidate"
    />
    <meta http-equiv="Cache" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link
      rel="stylesheet"
      href="https://kendo.cdn.telerik.com/2021.3.1207/styles/kendo.default-v2.min.css"
    />
    <script src="https://unpkg.com/vue@next"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2021.3.1207/js/kendo.all.min.js"></script>
    <title>Document</title>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        height: 200vh;
        overflow-x: hidden;
      }
      .background {
        background-image: url("https://picsum.photos/1980/1000");
        background-size: cover;
        background-position: 50% 50%;
        height: 200vh;
        font: 900 39rem "";
        line-height: 130vh;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        position: relative;
        text-align: center;
        overflow: hidden;
      }
      .background::before {
        content: "";
        background-size: cover;
        background-image: inherit;
        background-position: 50% 50%;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        z-index: -99;
      }
      h1 {
        position: absolute;
        text-align: center;
        width: 100%;
        letter-spacing: 10px;
        color: white;
      }
      h2 {
        position: absolute;

        width: 60%;
        top: 120vh;
        letter-spacing: 2px;
        color: white;
        left: 50%;
        transform: translateX(-50%);
        padding: 30%;
        background-color: rgba(0, 0, 0, 0.3);
      }
    </style>
  </head>
  <body>
    <h1>滚动</h1>
    <div class="background"><span>aaa</span></div>
    <h2>
      In winter, it is covered with snow and snow. When you climb to Jinding,
      you can see far and wide, and the scenery is very magnificent; West
      overlooking Aiai snow peak, Gongga Mountain and Wawu mountain, the
      mountains connect the sky; Looking south at the top of Ten Thousand
      Buddhas, the clouds are rolling and the momentum is magnificent; A
      panoramic view of the Pingchuan River in the north is as beautiful as a
      shop, with a panoramic view of the Dadu River and Qingyi River
    </h2>
    <script>
      const background = document.querySelector(".background");
      document.addEventListener("scroll", () => {
        const scrollY = window.scrollY;
        if (scrollY !== 0) {
          background.style.backgroundPosition = `calc(50% + ${scrollY}px) calc(50% + ${scrollY}px)`;
        } else {
          background.style.backgroundPosition = "";
        }
      });
    </script>
  </body>
</html>
